package p1;

/**
 * Created with IntelliJ IDEA.
 * Description:isAlive线程是否结束(存活)
 * User: LianBao
 * Date: 2024-06-07
 * Time: 15:05
 */
public class demo9 {
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            while (true) {
                System.out.println("Hello Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        System.out.println(t.isAlive());//启动之前,false
        t.start();
        System.out.println(t.isAlive());
    }
}
